#include "cpu/exec/helper.h"

//不用模板了，直接实例化
make_helper(ret){
    current_sreg = R_SS;//ret涉及栈操作
    cpu.eip = swaddr_read(cpu.esp,4) - 1;
    cpu.esp += 4;
    print_asm("ret");
    return 1; //指令总长度为1
}


make_helper(ret_i_w){  //return并从栈中弹出额外的i个字节
    current_sreg = R_SS;//ret涉及栈操作
    uint16_t imm = instr_fetch(cpu.eip + 1,2);
    cpu.eip = swaddr_read(cpu.esp,4) - 3;
    cpu.esp += 4 + imm;
    print_asm("ret $0x%x", imm);
    return 3;//指令总长度为1+2=3
}